//
//  SINATecManagerLeaveModel.m
//  sinashebao
//
//  Created by  androidlongs on 2018/1/9.
//  Copyright © 2018年  androidlongs. All rights reserved.
//

#import "SINATecManagerLeaveModel.h"

@implementation SINATecManagerLeaveModel
-(instancetype)initWithDict:(NSDictionary *)result{
    if (self=[super init]) {
        
        /*
         {
         "endtime": 1517803200000,
         "starttime": 1517796000000,
         "uuid": "6abb940b5af449f5911cd4f97c68d864",
         "typename": "病假",
         "realname": "赵七",
         "status": "1004"
         
         */
        
        _endtime=result[@"endtime"];
        _starttime=result[@"starttime"];
        _uuid=result[@"uuid"];
        
        _leaveTypeName=result[@"typename"];
        _realname=result[@"realname"];
        _status=[result[@"status"] integerValue];
        
        
        /*
         {
         "collegename": "数学学院",
         "reason": "啦啦啦",
         "cnt": 1,
         "approvalname": "樊老师",
         "endtime": 1517803200000,
         "starttime": 1517796000000,
         "uuid": "6abb940b5af449f5911cd4f97c68d864",
         "classifyname": "高数1班",
         "leavename": "赵七",
         "imgurls": "http://p1yo4p71t.bkt.clouddn.com/1517798434239.jpg",
         "approvaltime": 1517916188000,
         "collsystemname": "数学系",
         "typename": "病假",
         "status": "1004"
         }
         */
        
        _collegename =result[@"collegename"];
        
        _reason=result[@"reason"];
        _cnt=result[@"cnt"];
        _approvalname=result[@"approvalname"];
        
        _leaveTypeName=result[@"typename"];
        _classifyname=result[@"classifyname"];
        _leavename=result[@"leavename"];
        
        
        _imgurls=result[@"imgurls"];
        _collsystemname=result[@"collsystemname"];
        _approvaltime=result[@"approvaltime"];
        
        _imgurls=result[@"imgurls"];
        if (_imgurls!=nil&&![_imgurls isEqualToString:@""]) {
            NSMutableArray *imageArray = [[NSMutableArray alloc]init];
            if ([_imgurls containsString:@","] ) {
                NSArray *temp=[_imgurls componentsSeparatedByString:@","];
                if (temp.count>0) {
                    for (NSInteger i=0; i<temp.count; i++) {
                        [imageArray addObject:temp[i]];
                    }
                } else {
                     [imageArray addObject:_imgurls];
                }
               
            } else {
                [imageArray addObject:_imgurls];
            }
            
            _imageUrlArray=imageArray;
        }
    }
    return self;
}
+(instancetype)userWithDict:(NSDictionary *)dict{
    return [[self alloc] initWithDict:dict];
}
@end
